<?php
class Google_Accounts extends Ot_Db_Table 
{
    /**
     * Database table name
     *
     * @var string
     */
    public $_name = 'google_accts';

    /**
     * Primary key for the database
     *
     * @var string
     */
    protected $_primary = 'gmailAcctId';

	public function form(array $default = array())
    {
    	$form = new Zend_Form();
    	$form->setAction('')
             ->setMethod('post')
             ->setAttrib('id', 'typeForm')
             ->setDecorators(array(
                 'FormElements',
                 array('HtmlTag', array('tag' => 'div', 'class' => 'zend_form')),
                 'Form',
             ));
            	         
        $gmailUsername = $form->createElement('text', 'gmailUsername', array('label' => 'Gmail Email Address:'));
        $gmailUsername->setRequired(true)
             ->addFilter('StringTrim')
             ->addFilter('StripTags')
             ->setAttrib('size', '75')
             ->setAttrib('maxlength', '255')
             ->setValue((isset($default['gmailUsername'])) ? $default['gmailUsername'] : '');
       	
        $submit = $form->createElement('submit', 'saveButton', array('label' => 'Save Account'));
        $submit->setDecorators(array(
                   array('ViewHelper', array('helper' => 'formSubmit'))
                 ));
        
        $cancel = $form->createElement('button', 'cancel', array('label' => 'Cancel'));
        $cancel->setAttrib('id', 'cancel');
        $cancel->setDecorators(array(
                   array('ViewHelper', array('helper' => 'formButton'))
                ));        
                            
        $form->addElements(array($gmailUsername))
             ->setElementDecorators(array(
                     'ViewHelper',
                     'Errors',      
                     array('HtmlTag', array('tag' => 'div', 'class' => 'elm')), 
                     array('Label', array('tag' => 'span')),      
             ))
             ->addElements(array($submit, $cancel));
             
        return $form;
    }
    
	public function removeAccountForm(array $default = array())
    {
    	$form = new Zend_Form();
    	$form->setAction('')
             ->setMethod('post')
             ->setAttrib('id', 'typeForm')
             ->setDecorators(array(
                 'FormElements',
                 array('HtmlTag', array('tag' => 'div', 'class' => 'zend_form')),
                 'Form',
             ));
       	
        $submit = $form->createElement('submit', 'saveButton', array('label' => 'Remove Account'));
        $submit->setDecorators(array(
                   array('ViewHelper', array('helper' => 'formSubmit'))
                 ));
        
        $cancel = $form->createElement('button', 'cancel', array('label' => 'Cancel'));
        $cancel->setAttrib('id', 'cancel');
        $cancel->setDecorators(array(
                   array('ViewHelper', array('helper' => 'formButton'))
                ));        
                            
        $form->addElements(array($submit, $cancel));
             
        return $form;
    }





}